import styles from './styles.module.scss'
import Link from 'next/link'
import PlayIcon from '@/assets/news/play.png'
const BrocadeCollection = ({ data, style, link, title }) => {
  if (data?.length === 0) return <></>
  return (
    <section style={style} className={styles.recommend}>
      <p>{title}</p>
      <ul>
        {
          data?.map(row => (
            <Link href={link(row)} key={row?.id} target="_blank">
              <a target="_blank" title={row?.title || row?.videoName}>
                <img src={row?.coverImg || row?.videoImg} alt={row?.newsTitle} />
                <p>{row?.title || row?.videoName}</p>
                <img src={PlayIcon.src} alt="" className={styles.playicon} />
              </a>
            </Link>
          ))
        }
      </ul>
    </section>
  )
}


BrocadeCollection.defaultProps = {
  title: "热门集锦"
}


export default BrocadeCollection